from math import sqrt

def prime(max):
    primes = [2]
    i = 3
    while True:
        if i > max:
            break
        is_prime = True
        max_f = int(sqrt(i))
        for p in primes:
            if p > max_f:
                break
            if i % p == 0:
                is_prime = False
                break
        if is_prime:
            primes.append(i)
        i += 1
    return primes

print sum(prime(2000000))
                